Skip to content

Conversation

@slaren
Copy link
Member

@slaren slaren commented Nov 19, 2024

I don't think we will be able to use this in large file since it breaks the alignment in many cases, but it should be ok for some files and formatting selections.

Formatted llama-bench.cpp as an example.

Note: this .clang-format file is compatible with clang-format 17. It may not work with previous versions.

Copy link
Collaborator

@JohannesGaessler JohannesGaessler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be fine with enforcing a specific code style. I don't know about other IDEs/editors but the one I use (Doom Emacs) unfortunately does not highlight code that is in violation of the format specified in.clang_format. I can still format code from the command line using clang-format but one of my weaknesses is that I am prone to forgetting things like this.

It may make sense to amend CONTRIBUTING.md to instruct people to format newly added code.

SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be c++11?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be moving to c++17 now. The was some discussion on #10180.

@slaren slaren merged commit fab5d30 into master Nov 20, 2024
55 checks passed
@slaren slaren deleted the sl/clang-format branch November 20, 2024 11:57
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants